# Contributor: Breno Leitao <breno.leitao@gmail.com>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=py3-packaging
_pkgname=packaging
pkgver=24.1
pkgrel=0
pkgdesc="Core utilities for Python3 packages"
options="!check" # Requires py3-pytest which requires py3-setuptools
url="https://pypi.org/project/packaging"
arch="noarch"
license="Apache-2.0 AND BSD-2-Clause"
depends="python3 py3-parsing"
makedepends="py3-flit-core py3-gpep517"
# disable check to break circular dep with py3-setuptools
checkdepends="py3-pytest py3-pretend"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/packaging/packaging-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-packaging" # Backwards compatibility
provides="py-packaging=$pkgver-r$pkgrel" # Backwards compatibility

[ "$CARCH" = s390x ] && options="$options !check" # fails a lot

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--ignore=tests/test_tags.py \
		--deselect \
		tests/test_manylinux.py::test_is_manylinux_compatible_old
}

sha512sums="
fba8b94c1798c380c6af2c7fe211137fcc5669b1af3b0de52d6bcba05907f5bc74693df740677213d6c230e8d2db48ab9c4b8309752813c25cee87f1622fd4ab  packaging-24.1.tar.gz
"
